package timbap.visualizer.api.context.messaging;

import timbap.visualizer.api.model.TimeCode;

/**
 * The <code>AbstractTimeCodePublisher</code> provides a base
 * implementation for all time code publishing classes.
 *
 * @author  Andreas Pabst
 * @see timbap.visualizer.api.model.TimeCode
 * @see timbap.visualizer.api.context.messaging.TimeCodePublisher
 * @see timbap.visualizer.api.context.messaging.TimeCodeListener
 */
public abstract class AbstractTimeCodePublisher implements TimeCodePublisher {
    
    private TimeCodeListener timeCodeListener;

    public AbstractTimeCodePublisher() {
        super();
    }
    
    public void publishTimeCode(TimeCode pTimeCode) {
        if (timeCodeListener != null) {
            timeCodeListener.timeCodeUpdated(pTimeCode);
        }
    }

    public void setTimeCodeListener(TimeCodeListener pTimeCodeListener) {
        timeCodeListener = pTimeCodeListener;   
    }
    
}
